import config from "@/config"
import http from "@/utils/request"

export default {
  getFormData: {
    url: `${config.API_URL}/operationAuto/getJson`,
    name: "根据code类别获取对应form",
    get: function (param) {
      return new Promise((resolve, reject) => {
        http.get(this.url, param).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  addOperation: {
    url: `${config.API_URL}/operationAuto/add`,
    name: '增加参数',
    post: function (data) {
      return new Promise((resolve, reject) => {
        http.post(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  saveOperation: {
    url: `${config.API_URL}/operationAuto/editOne`,
    name: '保存参数',
    post: function (data) {
      return new Promise((resolve, reject) => {
        http.post(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  }
}